﻿using System;
using Microsoft.Phone.Controls.Maps.Platform;
using Serialization;

namespace BingleMaps.Models
{
	public class DirectionPoint : SearchQuery
	{
		[DoNotSerialize]
		public const string CurrentLocationString = "Current Location";

		public new string Input
		{
			get { return base.Input; }
			set
			{
				if (base.Input != null)
				{
					Location = null;
				}
				base.Input = value;
			}
		}

		public Location Location
		{
			get { return _location; }
			set { SetProperty(ref _location, value, LocationPropertyName); }
		}

		private Location _location;
		private const string LocationPropertyName = "Location";

		[DoNotSerialize]
		public bool IsCurrentLocation
		{
			get { return !string.IsNullOrEmpty(base.Input) && base.Input.Equals(CurrentLocationString, StringComparison.CurrentCultureIgnoreCase); }
		}
	}
}
